Maxsize = 100
class sqlist : 
    # 定义构造方法
    def __init__(self,m=Maxsize):
        self.elem=[0]*m
        self.len = 0
    # 定义创建方法
    def create(self,a):
        len = len(a)
        for i in range(self.len):
            self.elem = a[i]
    # 自定义遍历功能
    def output(self):
        for i in range(self.len):
            if i>0:
                print(" ",end="")
            print(self.elem[i])
        print()
    # 查找功能
    def search(self,x):
        for it in self.elem:
            if it == x :
                return True
        return False
    # 删除功能
    def delete (self,i):
        if self.len<1:
            print("顺序表为空，不能删除！")
            return
        if i < 1 or i > self.len:
            print("位置错误，小标越界")
            return
        
    # 插入功能
    def insert(self,i,x):
        if i <1 or i>self.len+1:
            print("无效的插入位置")
            return
        for j in range(self.len,i-1,-1):
            self.elem[j]=self.elem[j-1]
        self.elem[i-1]=x
        self.len+=1

# a = list(map(int,input("请输入各元素，空格隔开：").split()))
a = [1,2,3,4,5]
l = sqlist()
l.insert(1,12)
print(l.elem)
print(l.len)

if l.search(int(input("请输入查找元素"))):
    print('元素找到')
else:
    print('元素不存在')

